home *** CD-ROM | disk | FTP | other *** search
- package com.sun.xml.parser;
-
- final class ContentModel {
- public char type;
- public Object content;
- public ContentModel next;
- private SimpleHashtable cache = new SimpleHashtable();
-
- public ContentModel(char var1, ContentModel var2) {
- this.type = var1;
- this.content = var2;
- }
-
- public ContentModel(String var1) {
- this.type = 0;
- this.content = var1;
- }
-
- public boolean empty() {
- switch (this.type) {
- case '\u0000':
- case '+':
- return false;
- case '*':
- case '?':
- return true;
- case ',':
- if (!(this.content instanceof ContentModel)) {
- return false;
- } else if (!((ContentModel)this.content).empty()) {
- return false;
- } else {
- for(ContentModel var2 = this.next; var2 != null; var2 = var2.next) {
- if (!var2.empty()) {
- return false;
- }
- }
-
- return true;
- }
- case '|':
- if (this.content instanceof ContentModel && ((ContentModel)this.content).empty()) {
- return true;
- } else {
- for(ContentModel var1 = this.next; var1 != null; var1 = var1.next) {
- if (var1.empty()) {
- return true;
- }
- }
-
- return false;
- }
- default:
- throw new InternalError();
- }
- }
-
- public boolean first(String var1) {
- Boolean var2 = (Boolean)this.cache.get(var1);
- if (var2 != null) {
- return var2;
- } else {
- boolean var3;
- switch (this.type) {
- case '\u0000':
- case '*':
- case '+':
- case '?':
- if (this.content instanceof String) {
- var3 = this.content == var1;
- } else {
- var3 = ((ContentModel)this.content).first(var1);
- }
- break;
- case ',':
- if (this.content instanceof String) {
- var3 = this.content == var1;
- } else if (((ContentModel)this.content).first(var1)) {
- var3 = true;
- } else if (!((ContentModel)this.content).empty()) {
- var3 = false;
- } else if (this.next != null) {
- var3 = this.next.first(var1);
- } else {
- var3 = false;
- }
- break;
- case '|':
- if (this.content instanceof String && this.content == var1) {
- var3 = true;
- } else if (((ContentModel)this.content).first(var1)) {
- var3 = true;
- } else if (this.next != null) {
- var3 = this.next.first(var1);
- } else {
- var3 = false;
- }
- break;
- default:
- throw new InternalError();
- }
-
- if (var3) {
- this.cache.put(var1, Boolean.TRUE);
- } else {
- this.cache.put(var1, Boolean.FALSE);
- }
-
- return var3;
- }
- }
- }
-